<?php
class Bootstrap_Cache {	
	/**
     * _buildCache 
     * 
     * @access public
     * @return Zend_Cache_Core
     */
	static public function build()	{	
		if(Zend_Registry::isRegistered('cache')){
			$cache = Zend_Registry::get('cache');
		}else{
			$config = Zend_Registry::get('config');			
			$frontendOptions = $config->cache->toArray();			
			$backendOptions['cache_dir'] = CACHE_DIR;
			$cache = Zend_Cache::factory("Core", "File", $frontendOptions, $backendOptions);			
			Zend_Registry::set('cache', $cache);	
		}		
		Zend_Db_Table::setDefaultMetadataCache($cache);	
		return $cache;
	}
}